﻿namespace NEvoWeb.Modules.NB_Store
{
    using DotNetNuke.Common.Utilities;
    using System;
    using System.Collections;

    public class TaxController
    {
        public void DeleteTaxRate(int ItemID)
        {
            DataProvider.Instance().DeleteNB_Store_TaxRates(ItemID);
        }

        public NB_Store_TaxRatesInfo GetTaxRate(int PortalID, int ItemID)
        {
            return (NB_Store_TaxRatesInfo) CBO.FillObject(DataProvider.Instance().GetNB_Store_TaxRates(PortalID, ItemID), typeof(NB_Store_TaxRatesInfo));
        }

        public NB_Store_TaxRatesInfo GetTaxRateByObjID(int PortalID, int ObjectID, string TaxType)
        {
            return (NB_Store_TaxRatesInfo) CBO.FillObject(DataProvider.Instance().GetNB_Store_TaxRatesByObjID(PortalID, ObjectID, TaxType), typeof(NB_Store_TaxRatesInfo));
        }

        public ArrayList GetTaxRatesList(int PortalID, string TaxType)
        {
            return this.GetTaxRatesList(PortalID, TaxType, "", "");
        }

        public ArrayList GetTaxRatesList(int PortalID, string TaxType, string Lang, string Filter)
        {
            return CBO.FillCollection(DataProvider.Instance().GetNB_Store_TaxRatess(PortalID, TaxType, Lang, Filter), typeof(NB_Store_TaxRatesInfo));
        }

        public void UpdateObjTaxRate(NB_Store_TaxRatesInfo objInfo)
        {
            DataProvider.Instance().UpdateNB_Store_TaxRates(objInfo.PortalID, objInfo.ItemID, objInfo.ObjectID, objInfo.TaxPercent, objInfo.TaxDesc, objInfo.TaxType, objInfo.Disable);
        }
    }
}

